package com.minivision.fdiot.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;

/**
 * Ehcache缓存配置
 * @author hughzhao
 * @2018年3月1日
 */
@Configuration
public class CacheConfig {

  @Autowired
  private CacheManager cacheManager;

  @Bean
  public Cache faceCache() {
    return cacheManager.getCache("face");
  }
  
  @Bean
  public Cache downloadTokenCache() {
    return (Cache) cacheManager.addCacheIfAbsent("downloadCache");
  }
  
}
